const Home = () => import("@/pages/Home");
const Register = () => import("@/pages/Register");
const Login = () => import("@/pages/Login");
const Search = () => import("@/pages/Search");
const Detail = () => import("@/pages/Detail");
const AddCartSuccess = () => import("@/pages/InsertCartSuccess");
const ShopCart = () => import("@/pages/ShopCart");

export default [
  {
    path: "/home",
    component: Home,
    name: "home",
  },
  {
    path: "/search/:searchKey?",
    component: Search,
    name: "search",
  },
  {
    path: "/login",
    component: Login,
    name: "login",
    //目前这个meta的值不能通过props传递,然后再App中接受,因为props传递以后,只能在当前路由组件Login中接受
    meta: {
      //不要书写isShow为false,因为这样的话,其他路由没有设置isShow,那么isShow的值也会转为false
      // isShow: false,
      //其他组件没有isHidden属性.则默认isHidden是undefined,转为false
      isHidden: true,
    },
  },
  {
    path: "/register",
    component: Register,
    name: "register",
    meta: {
      isHidden: true,
    },
  },
  {
    path: "/detail/:skuId",
    component: Detail,
    name: "detail",
  },
  {
    path: "/addCartSuccess",
    component: AddCartSuccess,
    name: "addCartSuccess",
  },
  {
    path: "/shopCart",
    component: ShopCart,
    name: "shopCart",
  },
  {
    path: "/",
    redirect: "/home",
  },
  /* {
    path: "/*",
    component: NotFound,
  }, */
];
